package com.pro.control;

import com.pro.dao.ProductCaegoryMapper;
import com.pro.entity.JsonData;
import com.pro.service.ProductCaegoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.logging.Logger;

/**
 * @ClassName: ProductCaegoryController4
 * @Author: 笑笑
 * @DATE: 2021/11/6
 * @TIME: 下午 02:44
 */
@Controller
@RequestMapping("/ProductCaegory")
public class ProductCaegoryController {

    @Autowired
    private ProductCaegoryService productCaegoryService;

    //根据分类名称查询分类
    @RequestMapping("/getByName")
    @ResponseBody
    public JsonData getByName(String categroyTitle) {
        Integer byName = productCaegoryService.getByName(categroyTitle);
        return byName != null ? JsonData.buildSuccess(byName) : JsonData.buildError("服务器错误");
    }
}
